package org.hu.service;

import org.hu.mapper.MeetingRoomMapper;
import org.hu.model.MeetingRoom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MeetingRoomService {
    @Autowired
    MeetingRoomMapper meetingRoomMapper;

    /**
     * 查询所有会议室
     * @return List<MeetingRoom>
     */
    public List<MeetingRoom> getAllMr() {
        return meetingRoomMapper.getAllMr();
    }

    /**
     * 通过编号查询会议室
     * @param id 会议室编号
     * @return MeetingRoom
     */
    public MeetingRoom getMrDetail(Integer id) {
        return meetingRoomMapper.getMrById(id);
    }

    /**
     * 更新会议室详情
     * @param meetingRoom 会议室对象
     * @return Integer 0为失败 1为成功
     */
    public Integer updateRoomDetail(MeetingRoom meetingRoom) {
        return meetingRoomMapper.updateRoomDetail(meetingRoom);
    }

    /**
     * 添加会议室
     * @param meetingRoom 会议室对象
     * @return Integer 0为失败 1为成功
     */
    public Integer doAddMr(MeetingRoom meetingRoom) {
        return meetingRoomMapper.doAddMr(meetingRoom);
    }

    /**
     * 通过会议室状态查找会议室
     * @param i 0为空闲 1为已占用
     * @return
     */
    public List<MeetingRoom> getMrByStatus(int i) { return meetingRoomMapper.getMrByStatus(i); }
}
